package cn.wsalix.templet.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import lombok.Data;
import lombok.EqualsAndHashCode;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import cn.anlaser.entity.CommonEntity;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * @author jskyme 模板实体
 */
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "TEMPLET")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@EntityListeners({ AuditingEntityListener.class })
@Data
@EqualsAndHashCode(callSuper = false)
public class Templet extends CommonEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3575615334534868276L;
	@Column(name = "NAME")
	private String name;
	@Column(name = "CODE")
	protected String code;
	private String srcPath;// 模板下载地址
	private String logo;// 模板logo
	private String savePath; // place模板位置
	private String version;
	// private boolean original;//原版
	private String remark;

	@JsonIgnore
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "templet")
	private List<TempletPage> templetPages = new ArrayList<TempletPage>();
}
